package com.heima.behavior.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * web mvc配置
 *
 * @author DiXiaoNie
 * @date 2022/12/21
 * @since 2022/12/21 16:18
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    /**
     * 添加拦截器
     *
     * @param registry 注册表
     * @author DiXiaoNie
     * @date 2022/12/21
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TokenInterceptor())
                //表示拦截所有请求
                .addPathPatterns("/**")
                //排除满足条件的请求
                .excludePathPatterns("/login/in");
    }
}
